/*
	循环点亮 led1, led2, led3
*/

void delay(volatile int d)
{
	while (d--);
}


int main()
{
	volatile unsigned int *pGPFCON =  (unsigned int *)0x56000050;
	volatile unsigned int *pGPFDATA = (unsigned int *)0x56000054;

	/* 设置GPFCON让GPF4/5/6配置为输出引脚 */
	*pGPFCON &= ~((3<<8) | (3<<10) | (3<<12));   // 清零 
	*pGPFCON |=  ((1<<8) | (1<<10) | (1<<12));   // 配置为输出引脚 

	// 循环点亮
	volatile int val = 0; /* 0b000， 0b111 */
	volatile int tmp;
	
	while(1)
	{
		tmp = ~val; // 取反
		tmp &= 7;   // 0b0111
	
		*pGPFDATA &= ~(7<<4);
		*pGPFDATA |= (tmp << 4);

		delay(100000);

		val++;

		if(val == 8)
			val = 0;
	}
}





